import 'package:finance_app/src/entities/account_dashboard_entity.dart';

accountDashboardEntityFromJson(AccountDashboardEntity data, Map<String, dynamic> json) {
	if (json['incoming'] != null) {
		data.incoming = json['incoming'].toString();
	}
	if (json['incoming_amount'] != null) {
		data.incomingAmount = json['incoming_amount'] is String
				? num.tryParse(json['incoming_amount'])
				: json['incoming_amount'];
	}
	if (json['outgoing'] != null) {
		data.outgoing = json['outgoing'].toString();
	}
	if (json['outgoing_amount'] != null) {
		data.outgoingAmount = json['outgoing_amount'] is String
				? num.tryParse(json['outgoing_amount'])
				: json['outgoing_amount'];
	}
	return data;
}

Map<String, dynamic> accountDashboardEntityToJson(AccountDashboardEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['incoming'] = entity.incoming;
	data['incoming_amount'] = entity.incomingAmount;
	data['outgoing'] = entity.outgoing;
	data['outgoing_amount'] = entity.outgoingAmount;
	return data;
}